//
//  YHMediator.h
//  AFNetworking
//
//  Created by 000 on 2021/12/25.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class YHRequest;
@class YHRequestResponse;

@protocol YHMediatorHttpProtocol <NSObject>

@required
/// 默认发起请求的域名
- (NSString *)http_defaultDomain;

- (void)http_handleErrorCode:(NSInteger)errorCode
          responseStatusCode:(NSInteger)responseStatusCode
                     message:(NSString * _Nullable)message
                     request:(YHRequest *)request;

/// 请求头公用配置
- (NSDictionary <NSString *,NSString *>*)http_requestHeaderFieldValuePublic;

@optional

/// 成功状态下返回的message 看是否需要HUD
- (void)http_HUDSuccessMessage:(NSString * _Nullable)message;

- (NSString*)http_codeStr:(NSInteger)code;

/// 参数加密
- (NSDictionary *)http_parameterEncryption:(NSDictionary *)parame;
/// 文件上传参数加密
- (NSDictionary *)http_fileUploadParameterEncryption:(NSDictionary *)parame;
/// 请求头参数加密
- (NSDictionary <NSString *,NSString *>*)http_requestHeaderParameterEncryption:(NSDictionary *)parame;

/// 通过请求成功状态下返回的code 判断该请求是否算请求成功状态
- (BOOL)http_requestIsSuccessWithResponseCode:(NSInteger)code;


/// 开始请求
- (void)http_requestStart:(YHRequest *)request;
/// 结束请求
- (void)http_requestEnd:(YHRequest *)request;
/// 请求成功
- (void)http_requestSuccess:(YHRequest *)request response:(YHRequestResponse *)response;
/// 请求失败
- (void)http_requestFail:(YHRequest *)request response:(YHRequestResponse *)response;

@end

@interface YHMediator : NSObject

@property (retain, nonatomic) id<YHMediatorHttpProtocol> http;

@end

NS_ASSUME_NONNULL_END
